package com.kaifamiao.util;

import lombok.Data;

import java.io.Serializable;

@Data
public class ResponseUtil implements Serializable {
    private int code;
    private String msg;
    private Object data;
    public ResponseUtil(int code, String msg, Object data){
        this.code=code;
        this.msg=msg;
        this.data=data;
    }

    public static ResponseUtil ok(){
        return new ResponseUtil(1,"请求成功",null);
    }
    public static ResponseUtil ok(String msg){
        return new ResponseUtil(1,msg,null);
    }
    public static ResponseUtil ok(String msg,Object data){
        return new ResponseUtil(1,msg,data);
    }
    public static ResponseUtil error(String msg){
        return new ResponseUtil(0,msg,null);
    }
    public static ResponseUtil error(String msg,Object data){
        return new ResponseUtil(0,msg,data);
    }
}
